/// <reference path="../../sage/sage.util.js" />

var CloudPainter = Base.extend({
    initialize: function initialize() { },
    paint: function paint(context) {
        var rect = context.gameObject.locationRelativeToCamera.objectRectangle,
            x = rect.x,
            y = rect.y,
            w = rect.w,
            h = rect.h,
            r = (h > 4.0 ? h / 4.0 : 1.0);

        context.frontLayer.fillStyle = context.gameObject.color;
        context.frontLayer.beginPath();
        context.frontLayer.moveTo(x + r, y);
        context.frontLayer.lineTo(x + w - r, y);
        context.frontLayer.quadraticCurveTo(x + w, y, x + w, y + r);
        context.frontLayer.lineTo(x + w, y + h - r);
        context.frontLayer.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
        context.frontLayer.lineTo(x + r, y + h);
        context.frontLayer.quadraticCurveTo(x, y + h, x, y + h - r);
        context.frontLayer.lineTo(x, y + r);
        context.frontLayer.quadraticCurveTo(x, y, x + r, y);
        context.frontLayer.closePath();
        context.frontLayer.fill();
    }
});
